package web.request;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

//请求转发2
@WebServlet(value = "/d5")
public class ServletDemo5 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("d5...");
        // 根据键获取转发来的数据
        Object nba = request.getAttribute("nba");
        System.out.println(nba);
        // 删除转发的数据
        System.out.println("现在删除nba这个键对应的键值对");
        request.removeAttribute("nba");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
